Preparativos
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(sf)
## Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE
library(ggplot2)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(DT)
library(leaflet)
felinos <-
st_read(
"C:/Users/gf0604-1/Perci/Prácticasf/felinos.csv",
options = c(
"X_POSSIBLE_NAMES=decimalLongitude",
"Y_POSSIBLE_NAMES=decimalLatitude"
),
quiet = TRUE
)
Tabla
felinos %>%
select(species,
eventDate,
stateProvince,
locality,
decimalLongitude,
decimalLatitude) %>%
st_drop_geometry() %>%
datatable(
colnames = c(
"Especie",
"Fecha",
"Provincia",
"Localidad",
"Longitud",
"Latitud"
),
options = list(
pageLength = 5,
language = list(url = '//cdn.datatables.net/plug-ins/1.10.11/i18n/Spanish.json')
)
)
Gráfico
grafico_barras <-
felinos %>%
ggplot(aes(x = species)) +
geom_bar()
ggplotly(grafico_barras)